class P10193_39643 {

       static String readLn() {
               String newLine = System.getProperty("line.separator");
               StringBuffer buffer = new StringBuffer();
               int car = -1;
               try {
                       car = System.in.read();
                       while ((car > 0) && (car != newLine.charAt(0))) {
                               buffer.append((char) car);
                               car = System.in.read();
                       }
                       if (car == newLine.charAt(0))
                               System.in.skip(newLine.length() - 1);
               } catch (java.io.IOException e) {
                       return (null);
               }
               if ((car < 0) && (buffer.length() == 0))
                       return (null);
               return (buffer.toString()).trim();
       }

       public static void main(String[] args) {
               int cases = Integer.parseInt(readLn());

               for (int k = 0; k < cases; k++) {
                       String x = readLn();
                       String y = readLn();
                       int a = Integer.parseInt(x, 2);
                       int b = Integer.parseInt(y, 2);

                       if (gcd(a, b) == 1) {
                               System.out.println("Pair #" + (k+1) + ": Love is not all you need!");
                       } else {
                               System.out.println("Pair #" + (k+1) + ": All you need is love!");
                       }

               }
       }

       static int gcd( int a, int b ) {
               return b != 0 ? gcd( b,  a % b ) : a;

       }


}